<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<base href="<%=basePath%>">
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>西咸登录页</title>
		<link rel="stylesheet" href="css/bootstrap.min.css" /><!--公共样式-->
		<link rel="stylesheet" href="css/style_c.css"/>
	</head>
	<body class="xixian_login">
		<div class="login_comntainer">
			<div class="top_container">
				<div class="top_block">
					<a  href="menhu/mainpage"><img src="images/logo.png" /></a>
				</div>
		    </div>
		    <div class="mid_container_login">
		    	<div class="mid_block">
		    		<div class="mid_block_content">
			    		<div class="form_block">
			    			<h3>用户登录</h3>
			    		    <form id="loginf">
			    		    	<div class="form_group">
			    		    		<input type="text" name="userName" class="from_input" placeholder="请输入您的账号"/>
			    		    		<img src="images/input_logo1.png" class="form_icon"/>
			    		    	</div>
			    		    	<div class="form_group">
			    		    		<input type="password" name="userPassword" class="from_input" placeholder="请输入密码"/>
			    		    		<img src="images/input_logo2.png" class="form_icon"/>
			    		    	</div>
			    		    	<div class="form_group" style="margin-bottom: 10px;">
			    		    		<input type="text" name="userPid" class="from_input" placeholder="请输入验证码"/>
			    		    		<img src="images/input_logo3.png" class="form_icon"/>
			    		    		<div class="yanzhengma">
			    		    			<img src="admin/imgr" id="yangzhengma" onclick="changecode()">
			    		    		</div>
			    		    	</div>
			    		    	<div class="form_group" style="margin-bottom: 30px;">
			    		    		<input type="checkbox" class="form_checkbox" />
			    		    		<label>记住密码</label>
			    		    	</div>
			    		    	<div class="form_group" style="margin-bottom: 0px;">
			    		    		<a class="form_btn" href="javascript:dologin()">立即登录</a>
			    		    	</div>
			    		    </form>
			    	    </div>
			    	</div>
		    	</div>
		    	
		    	<div class="footer">
		    		<p>@版权所有&emsp;陕ICP备15005767号-4</p>
		    	</div>
		    </div>
		</div>
	</body>
	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript">
	function changecode(){
		document.getElementById("yangzhengma").src="admin/imgr?id="+ new Date().getTime(); //这里的图片是更换后的图片
	}
	function dologin(){
		$.ajax({
            cache: true,
            type: "POST",
            url:'admin/dologin',
            data:$('#loginf').serialize(),// 你的formid
            async: false,
            dataType:"text",
            error: function(request) {
                alert("Connection error");
            },
            success: function(data) {
            	  var str=JSON.parse(data);
                 if(str=="error"){
                 	alert("请正确填写信息！")
                 }else{
                	 window.location.href= str;
            	}
            }
        });
	}
	</script>
</html>
